import Cookies from 'js-cookie'
const TokenKey = 'Admin-Token'

// 获取Token
export function getToken() {
  const token = Cookies.get(TokenKey)
  if (token) {
    return decodeURI(token)
  }
  return null
}

// 设置Token
export function setToken(token) {
  return encodeURI(Cookies.set(TokenKey, token, {
    domain: process.env.DOMAIN
  }))
}

// 移除Token
export function removeToken() {
  return Cookies.remove(TokenKey, {
    domain: process.env.DOMAIN
  })
}
